//
//  VisitorView.swift
//  KKWB
//
//  Created by KSY-iOS on 17/1/8.
//  Copyright © 2017年 KK. All rights reserved.
//

import UIKit

class VisitorView: UIView {

    class func visitorView() -> VisitorView{
        
        return Bundle.main.loadNibNamed("VisitorView", owner: nil, options: nil)!.first as! VisitorView
    }
    
    
    @IBOutlet weak var rotetionView: UIImageView!
    @IBOutlet weak var iconView: UIImageView!
    @IBOutlet weak var tipLabel: UILabel!
    
    @IBOutlet weak var registerBtn: UIButton!
    @IBOutlet weak var loginBtn: UIButton!
    
    
    
    
    
    func setupVisitorViewInfo(_ iconName: String, title: String) {
        
        iconView.image = UIImage(named: iconName)
        tipLabel.text = title
        rotetionView.isHidden = true
        
    }
    
    func addRotationAnimation() {
        
        let rotationAnimation = CABasicAnimation(keyPath: "transform.rotation.z")
        
        rotationAnimation.fromValue = 0
        rotationAnimation.toValue = M_PI * 2
        rotationAnimation.repeatCount = MAXFLOAT
        rotationAnimation.duration = 3
        rotationAnimation.isRemovedOnCompletion = false
        
        rotetionView.layer.add(rotationAnimation, forKey: nil)
        
    }
}
